<?php
/**
 * OrangeHRM is a comprehensive Human Resource Management (HRM) System that captures
 * all the essential functionalities required for any enterprise.
 * Copyright (C) 2006 OrangeHRM Inc., http://www.orangehrm.com
 *
 * OrangeHRM is free software; you can redistribute it and/or modify it under the terms of
 * the GNU General Public License as published by the Free Software Foundation; either
 * version 2 of the License, or (at your option) any later version.
 *
 * OrangeHRM is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
 * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 * See the GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License along with this program;
 * if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
 * Boston, MA  02110-1301, USA
 *
 */
$styleSheet = "orange";

$GLOBALS['lang_Common_SortAscending'] = $lang_Common_SortAscending;
$GLOBALS['lang_Common_SortDescending'] = $lang_Common_SortDescending;

?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<link href="../../themes/<?php echo $styleSheet; ?>/css/style.css" rel="stylesheet" type="text/css"/>
<!--[if lte IE 6]>
<link href="../../themes/<?php echo $styleSheet; ?>/css/IE6_style.css" rel="stylesheet" type="text/css"/>
<![endif]-->
<!--[if IE]>
<link href="../../themes/<?php echo $styleSheet; ?>/css/IE_style.css" rel="stylesheet" type="text/css"/>
<![endif]-->
<script type="text/javascript" src="../../themes/<?php echo $styleSheet;?>/scripts/style.js"></script>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<script type="text/javascript" src="../../scripts/octopus.js"></script>
<script type="text/javascript" src="../../scripts/common.js"></script>
<script type="text/javascript" src="../../scripts/jquery/jquery.js"></script>
<script charset="utf-8" src="../../templates/kindeditor/kindeditor-min.js"></script>
<script charset="utf-8" src="../../templates/kindeditor/lang/zh_CN.js"></script>

<script type="text/javascript">
var editor;
KindEditor.ready(function(K) {
	var editor;
		KindEditor.ready(function(K) {
			editor = K.create('textarea[name="content"]', {
				allowFileManager : true
			});
		$('#btnEdit').click(function(e) {
			 document.getElementById('content').value = editor.html();
			 add();
		});
	});
});

function add() {

	var title = document.getElementById('title').value;
	var writer = document.getElementById('writer').value;
	var content = document.getElementById('content').value;
	
	if(title == "" ){
		alert("标题不能为空");
		return;
	}

	if(writer == "" ){
		alert("发布人不能为空");
		return;
	}
	
	if(content == "" ){
		alert("内容不能为空");
		return;
	}

	//alert(content);
	
	document.standardView.submit();
}
	function clear_form() {
		document.standardView.title.value='';
		document.standardView.writer.value='';
		document.standardView.content.value='';
	}
	YAHOO.OrangeHRM.container.init();
</script>


<div class="formpage2col" style="width:900px;">
<form name="standardView" id="standardView" method="post" action="<?php echo $_SERVER['PHP_SELF']?>?oacode=oamange&action=news&s=save">
	<div class="outerbox">
		<div class="mainHeading"><h2>添加新闻公告</h2></div>
		<input type="hidden" name="aid" id="aid" value="<?php echo isset($records['aid']) ? $records['aid']:'';?>" />
        
		<label for="txttypname">标题 <span class="required">*</span></label>
		<input type="text" name="title" id="title" class="formInputText" 
			value="<?php echo isset($records['title']) ? $records['title']:'';?>"/><br>
		
		<br class="clear" />
        <label for="txttypname">属性</label>
        <input type="radio" id="flag" name="flag" value="c" <?php echo ($records['flag'] != 'a') ? "checked":'';?>>普通
        <input type="radio" id="flag" name="flag"  value="a" <?php echo ($records['flag'] == 'a') ? "checked":'';?>>首页显示
        </select>
        <br class="clear" />
        <label for="writer">发布人 <span class="required">*</span></label>
		<input type="text" name="writer" id="writer" class="formInputText" 
			value="<?php echo isset($records['writer']) ? $records['writer']:'';?>"/><br>
		<br class="clear" />
        <div style="width:900px;height:300px;">
		<label for="txtdescription" id="txtdescription">内容 <span class="required">*</span></label>
		
        <textarea name="content" id="content" style="width:700px;height:300px;visibility:hidden;"><?php echo isset($records['body']) ? $records['body']:'';?></textarea>
       
        </div>
		
        <div class="formbuttons">
			<input type="button" class="savebutton" id="btnEdit" 
				onmouseover="moverButton(this);" onmouseout="moutButton(this);"
				value="<?php echo $lang_Common_Save;?>" title="<?php echo $lang_Common_Save;?>" />
			<input type="button" class="resetbutton" onclick="clear_form(); return false;"
				onmouseover="moverButton(this);" onmouseout="moutButton(this);"
				 value="<?php echo $lang_Common_Reset;?>" />
        </div>
	</div>
	<div class="requirednotice"><?php echo preg_replace('/#star/', '<span class="required">*</span>', $lang_Commn_RequiredFieldMark); ?>.</div>
	</form>
</div>
<script type="text/javascript">
//<![CDATA[
    if (document.getElementById && document.createElement) {
        roundBorder('outerbox');
    }
//]]>
</script>
